package SnakeGame;

import java.util.Random;
import javax.microedition.lcdui.Graphics;

/**
 *
 * @author HOME
 */
public class Ponto {
    
    public int x , y ;
	Random r = new Random() ;
	
	public Ponto(Cobra c)
	{
		reset(c) ;
	}
	
	public void render(Graphics g)
	{
		g.setColor(0x6BF578) ;
		g.fillArc(x , y , Cobra.V , Cobra.V , 0 , 360) ;
	}
	
	public void reset(Cobra c) 
	{
		boolean bc = true ;
		while(bc)
		{
			x = Math.abs(r.nextInt() % (240 - Cobra.V)) ;
			y = Math.abs(r.nextInt() % (310 - Cobra.V)) ;
			bc = c.ehAtingido(x , y) ;
		}
	}
	
	public boolean ehAtingido(int _x , int _y)
	{
		if(Math.abs(x - _x) < Cobra.V &&Math.abs(y - _y) < Cobra.V)
		{
			return true ;
		}
		else
		{
			return false ;
		}
	}

}
